package com.topc.problem.model.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.topc.problem.model.po.ProblemInfo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDateTime;

@Data
@Accessors(chain = true)
public class ProblemPageShowVo {

    private Long id;

    private String title;

    private int difficulty;

    private int commitCount;

    private int correctCount;

    private int commitStatus;

    private int isPublic;

    @ApiModelProperty(name = "更新时间", notes = "")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    protected LocalDateTime updateTime;

    public ProblemPageShowVo(ProblemInfo problemInfo) {
        this.id = problemInfo.getId();
        this.title = problemInfo.getTitle();
        this.difficulty = problemInfo.getDifficulty();
        this.isPublic = problemInfo.getIsPublic();
        this.commitStatus = 0;
        this.updateTime = problemInfo.getUpdateTime();
    }
}
